import request from '@/utils/request.js'

// 获取优惠券列表
export const getCouponList = (data) => {
	return request({
		url: '/yhjInfo/list',
		data,
		method: "GET",
	})
}


export const getPop = () => {
	return request({
		url: '/yhjInfo/Popups',
		method: "GET",
	})
}

// 获取公告
export const getNoticeList = () => {
	return request({
		url: '/notice/list',
		method: "GET",
	})
}

// 商家登录
export const sLogin = (data) => {
	return request({
		url: '/yhjUser/loginBusiness',
		data,
		method: "POST",
	})
}


// 获取我的优惠券列表
export const getMyCouponList = (data) => {
	return request({
		url: '/yhjInfo/listByUser',
		data,
		method: "GET",
	})
}

// 获取优惠券详情
export const getCouponDetail = (data) => {
	return request({
		url: '/yhjInfo/' + data.yhjId,
		method: "GET",
	})
}

// 获取我的优惠券详情
export const getMyCouponDetail = (data) => {
	return request({
		url: '/yhjInfo/user/' + data.yhjId,
		method: "GET",
	})
}

// 领取优惠券
export const collectCoupon = (data) => {
	return request({
		url: '/yhjInfo/collect',
		data,
		method: "GET",
	})
}

// 优惠券核销
export const cancelCoupon = (data) => {
	return request({
		url: '/yhjInfo/cancel',
		data,
		method: "GET",
		type: 0
	})
}

// 获取用户信息
export const getUserInfo = () => {
	return request({
		url: '/user/profile',
		method: "GET",
	})
}

// code登录
export const codeLogin = (data) => {
	return request({
		url: '/yhjUser/login',
		data,
		method: "POST",
	})
}

// 手机号码登录
export const telLogin = (data) => {
	return request({
		url: '/yhjUser/loginPhone',
		data,
		method: "POST",
	})
}

// 修改用户信息
export const updateUserInfo = (data) => {
	return request({
		url: '/user/profile',
		data,
		method: "PUT",
	})
}